﻿using HotelManager.Model;

namespace HotelManager.DAL
{
    public class ResideStateService : IResideStateService
    {

        private readonly HotelDbContext _context;

        public ResideStateService(HotelDbContext context)
        {
            _context = context;
        }

        /// <summary>
        /// 获取房间状态列表
        /// </summary>
        /// <returns></returns>
        public List<ResideState> GetAllState()
        {
            // 使用LINQ查询获取所有房间状态
            return _context.ResideStates.ToList();
            //string sql = "Select * from ResideState";
            //SqlDataReader reader = SqlHelper.DataReader(sql);
            //List<ResideState> state = new List<ResideState>();
            //while (reader.Read())
            //{
            //    ResideState s = new ResideState();
            //    s.ResideId = Convert.ToInt32(reader["ResideId"]);
            //    s.ResideName = reader["ResideName"].ToString();
            //    state.Add(s);
            //}
            //reader.Close();
            //return state;
        }
    }
}
